// 类
class Person2{
  name: string
  age: number

  constructor(name: string, age: number){
    this.name = name
    this.age = age
  }

  run(){
    return `${this.name}的年龄为: ${this.age}`
  }
}

// 子类继承、男人
class Man2 extends Person2{
  // 新成员
  height: number

  // 构造方法的重写
  constructor(name: string, age: number, height: number){
    super(name, age)
    this.height = height
  }

  // 普通方法的重写
  run(): string{
    return `${super.run()}, 身高为: ${this.height}`
  }
}
let m2 = new Man2('男人', 30, 175)
console.log(m2.run())

// 子类继承、女人
class Woman2 extends Person2{}
let w2 = new Woman2('女人', 28)
console.log(w2.run())